package controller

import (
	"encoding/json"
	"net/http"
	mysqldata "w3c/model"
)

func (p Routes) Testmodel(w http.ResponseWriter, r *http.Request) {
	var RoutesList []mysqldata.Person
	mysqldata.DB.Find(&RoutesList)
	var houseList []mysqldata.House
	mysqldata.DB.Find(&houseList)

	ret := map[string]interface{}{

		"RoutesList": RoutesList,
		"houseList":  houseList,
	}

	err := json.NewEncoder(w).Encode(ret)

	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}
}
